<script setup>
import Son from "@/components/heredity/Son.vue";
import {ref} from "vue";
const money=ref(100);
const FaMsg=ref("");
const earnMoney=()=>{
  money.value+=100
}
const lessMoney=(args)=>{
  money.value-=args;
}
const message=(args)=>{
  FaMsg.value=args;
}
//子传父
</script>

<template>
<div><h3>我是父组件</h3><button class="button" @click="earnMoney">赚钱给孩子们</button>
  <son car="宝马车" :money="money" @consumeMoney="lessMoney" @send-msg="message"/></div>
<!--  <button @click="message">接收子组件传来的值</button>-->
  <h3>{{FaMsg}}</h3>
</template>

<style scoped>
.button{
  border: 1px solid black;
  padding: 30px;
}
</style>
